home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / cvs / sprite / info.c < prev    next >
C/C++ Source or Header  |  1991-09-05  |  2KB  |  113 lines

  1. #include "cvs.h"
  2.  
  3. info(argc, argv)
  4.     int argc;
  5.     char *argv[];
  6. {
  7.     int c, err = 0;
  8.  
  9.     if (argc == -1)
  10.     info_usage();
  11.     optind = 1;
  12.     while ((c = getopt(argc, argv, "fr:D:")) != -1) {
  13.     switch (c) {
  14.     case 'Q':
  15.         really_quiet = 1;
  16.         /* FALL THROUGH */
  17.     case 'q':
  18.         quiet = 1;
  19.         break;
  20.     case 'f':
  21.         force_tag_match = 1;
  22.         break;
  23.     case 'r':
  24.         (void) strcpy(Tag, optarg);
  25.         break;
  26.     case 'D':
  27.         Make_Date(optarg, Date);
  28.         break;
  29.     case '?':
  30.     default:
  31.         info_usage();
  32.         break;
  33.     }
  34.     }
  35.     argc -= optind;
  36.     argv += optind;
  37.     if (!isdir(CVSADM)) {
  38.     if (!quiet) {
  39.         warn(0, "warning: no %s directory found", CVSADM);
  40.     }
  41.     }
  42.     Name_Repository();
  43.     Reader_Lock();
  44.     if (argc <= 0) {
  45.     if (force_tag_match && (Tag[0] != '\0' || Date[0] != '\0'))
  46.         Find_Names(&fileargc, fileargv, ALLPLUSATTIC);
  47.     else
  48.         Find_Names(&fileargc, fileargv, ALL);
  49.     argc = fileargc;
  50.     argv = fileargv;
  51.     }
  52.     (void) Collect_Sets(argc, argv);
  53.     free_names(&fileargc, fileargv);
  54.     info_process_lists();
  55.     Lock_Cleanup(0);
  56. }
  57. /*
  58.  * Process the lists created by Collect_Sets().
  59.  */
  60. static
  61. info_process_lists()
  62. {
  63.     char *cp;
  64.     int err = 0;
  65.     /*
  66.      * Olist is the "needs checking out" list.
  67.      */
  68.     for (cp = strtok(Olist, " \t"); cp; cp = strtok((char *)NULL, " \t")) {
  69.     printf("U %s\n", cp);
  70.     }
  71.     /*
  72.      * Mlist is the "modified, needs checking in" list.
  73.      */
  74.     for (cp = strtok(Mlist, " \t"); cp; cp = strtok((char *)NULL, " \t")) {
  75.     printf("M %s\n", cp);
  76.     }
  77.     /*
  78.      * Alist is the "to be added" list.
  79.      */
  80.     for (cp = strtok(Alist, " \t"); cp; cp = strtok((char *)NULL, " \t")) {
  81.     printf("A %s\n", cp);
  82.     }
  83.     /*
  84.      * Rlist is the "to be removed" list.
  85.      */
  86.     for (cp = strtok(Rlist, " \t"); cp; cp = strtok((char *)NULL, " \t")) {
  87.     printf("R %s\n", cp);
  88.     }
  89.     /*
  90.      * Glist is the "modified, needs merging" list.
  91.      */
  92.     for (cp = strtok(Glist, " \t"); cp; cp = strtok((char *)NULL, " \t")) {
  93.     printf("C %s\n", cp);
  94.     }
  95.     /*
  96.      * Wlist is the "needs to be removed" list.
  97.      */
  98.     for (cp = strtok(Wlist, " \t"); cp; cp = strtok((char *)NULL, " \t")) {
  99.     printf("D %s\n", cp);
  100.     }
  101. }
  102.  
  103.  
  104. static
  105. info_usage()
  106. {
  107.     (void) fprintf(stderr,
  108.            "Usage: %s %s [-f] [-r tag|-D date] [files...]\n",
  109.            progname, command);
  110.     exit(1);
  111. }
  112.  
  113.